<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../lib/vue-2.4.0.js"></script>
</head>

<body>
  <div id="app">
    <h2>{{count}}</h2>
    <input type="text" v-on:focus="alertMsg">
    <button v-on:click="addCount">点我</button>
    <!-- v-on的简写方式 -->
    <!-- <button @click="addCount">点我</button> -->
  </div>
</body>
<script>
  let app = new Vue({
    el: '#app',
    data: {
      count: 0
    },
    methods: {
      addCount() {
        this.count++
      },
      alertMsg() {
        alert('获取了焦点')
      }
    }
  })
</script>

</html>